<template>
  <div id="app">
    <div class="button-group">
      <button @click="openSign">签名</button>
      <button @click="download">下载</button>
    </div>
    <sign v-if="showSign" @closeSign="closeSign" @updateUrl="updateUrl" />
    <HelloWorld ref="hello" :imgSrc="imgSrc" />
    <!-- <img v-if="imgSrc" :src="imgSrc" alt="签名"> -->
  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'
import sign from './components/sign.vue'

export default {
  name: 'app',
  components: {
    HelloWorld,
    sign
  },
  data() {
    return {
      imgSrc: null,
      showSign: false
    };
  },
  methods: {
    openSign() {
      this.showSign = true;
    },
    updateUrl($event) {
      this.imgSrc = $event
      this.showSign = false
    },
    closeSign() {
      this.showSign = false;
    },
    download() {
      this.$refs.hello.modifyPdf()
    }
  },
}
</script>

<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
.sign {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100000;
  overflow: hidden;
}
.button-group {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100000;
}
</style>
